<?php
	if($id == FALSE){
		$range_urus_izin	= set_value("range_urus_izin");
		$keterangan			= set_value("keterangan");
		$status				= set_value("status");
	} else {
		$range_urus_izin	= (set_value("range_urus_izin") == "") ? ($value["urus_izin"]) : (set_value("range_urus_izin"));
		$keterangan			= (set_value("keterangan") == "") ? ($value["keterangan"]) : (set_value("keterangan"));
		$status				= (set_value("status") == "") ? ($value["status_urus_izin"]) : (set_value("status"));
	}
?>
<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h4>
					<span>Form Master Frekuensi Urus Izin</span>
				</h4>
			</div>
			<div class="panel-body">
				<!-- <form class="form-horizontal" action="<?php echo site_url('master_responden/form_master_urus_izin')?>" method="post" role="form"> -->
				<?php
					$attributes = array('class' => 'form-horizontal', 'id'=>'form-validate', 'role' => 'form');

					if( $id == FALSE ) {
						echo form_open('master_responden/form_master_urus_izin/', $attributes);
					}
					else
						echo form_open('master_responden/form_master_urus_izin/'.$id, $attributes);
				?>
					<div class="form-group">
						<label class="col-lg-3 control-label" for="normalInput">Nama Urus Izin</label>
						<div class="col-lg-3">
							<input type="text" name="range_urus_izin" value="<?php echo $range_urus_izin; ?>" class="form-control">
						</div>
					</div><!-- End .form-group  -->
					<div class="form-group">
						<label class="col-lg-3 control-label" for="textareas">Keterangan</label>
						<div class="col-lg-3">
							<textarea id="textarea1" rows="3" name="keterangan" class="form-control elastic"><?php echo $keterangan; ?></textarea>
						</div>
					</div><!-- End .form-group  -->
					<?php if($id==FALSE) { ?>
						<div class="form-group">
							<label class="col-lg-3 control-label" for="select">Status</label>
							<div class="col-lg-3">
								<select name="status" class="form-control">
									<option value="">--Pilih Status--</option>
									<option <?php echo ($status == null) ? ("") : (($status == 1) ? ("selected") : ("")); ?> value="1" selected>Aktif</option>
									<option <?php echo ($status == null) ? ("") : (($status == 0) ? ("selected") : ("")); ?> value="0">Tidak Aktif</option>
								</select>
							</div>
						</div><!-- End .form-group  -->
					<?php } else { ?>
						<div class="form-group">
							<label class="col-lg-3 control-label" for="select">Status</label>
							<div class="col-lg-3">
								<select name="status" class="form-control">
									<option value="">--Pilih Status--</option>
									<option <?php echo ($status == null) ? ("") : (($status == 1) ? ("selected") : ("")); ?> value="1">Aktif</option>
									<option <?php echo ($status == null) ? ("") : (($status == 0) ? ("selected") : ("")); ?> value="0">Tidak Aktif</option>
								</select>
							</div>
						</div><!-- End .form-group  -->
					<?php } ?>
					<div class="form-group">
						<div class="col-lg-offset-3 col-lg-9">
							<button type="submit" class="btn btn-info">Simpan</button>
							<button type="reset" class="btn btn-warning">Reset</button>
							<button type="button" onClick="kembali()" class="btn btn-default">Kembali</button>
						</div>
					</div><!-- End .form-group  -->
				<!-- </form> -->
				<?php
					echo form_close();
				?>
			</div>
		</div>
	</div>
</div><!-- End .panel -->

<script language="javascript">
function kembali(){
	document.location="<?php echo site_url("master_responden/master_urus_izin"); ?>";
}

$(document).ready(function() {
    $("#form-validate").validate({
    	ignore: null,
    	ignore: 'input[type="hidden"]',
    	rules: {
			range_urus_izin: "required",
		},
		messages: {
			required: "Baris ini wajib diisi !!!",
		}
    });
});
</script>